import Cookies from 'js-cookie';
import appLocaleEn from './en-US';
import appLocaleZh from './zh-Hans-CN';

//export default appLocaleZh;

interface AppLocale {
  messages: any,
  antd: any,
  locale: string,
  data: any
}

/**
 * 返回取得的国际化对象
 * @param lang
 */
export function getLocale(lang: string = null): AppLocale {
  if (lang === null) {
    // 从cookie里面取
    lang = Cookies.get('lang');
  }
  switch (lang) {
    case 'zh':
      return appLocaleZh;
    case 'en':
      return appLocaleEn;
    default:
      return appLocaleEn;
  }
}
